<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        //【1】大集合调用indexOf确定子集合的位置。
        var skyorigin = "this is sky";
        var sky = "sky";
        var res = skyorigin.indexOf(sky);
        console.log(res); //8
        //【2】反方向
        var resagain = skyorigin.lastIndexOf(sky);
        console.log(resagain);
    </script>
</body>

</html>